/**
 * Created by HFY on 2017/3/27.
 */

var text = document.getElementById("text");
var pass = document.getElementById("pass");
var pwd = document.getElementById("pwd");
text.onfocus = function () {
        if(text.value == "账号") {
            text.value = "";
            text.style.color = "#333"
        }
}

text.onblur= function () {
    if(text.value == "") {
        text.value = "账号";
        text.style.color = "#B4B4B4"
        console.log('不能为空');
    }else if((/[\u4e00-\u9fa5]+/).test(text.value)) {
        // text.value="";
        // text.focus();
    }
}
/*pwd.onfocus = function () {
    if(this.value =="密码"){
        this.style.display="none";
        pass.style.display="block";
        this.value ="";
        pass.value="";
        pass.style.color = "#333"
        pass.focus();
    }
}*/
pass.onblur=function(){
    if(this.value ==""){
        pwd.style.display = "block"
        pwd.value="密码";
        pass.style.display = "none"
    }else {
        pwd.style.display = "none";
        pass.style.display = "block"
    }
}

$(".sub").click(function () {
    if($("#text").val() == "账号" ) {
        console.log("用户名不能为空");
        return false;
    }else if($("#pwd").val() == "密码") {
        console.log("密码不能为空");
        return false;
    }
})
//页面错误提醒
$(".alert_warning_a").click(function () {
    $(".alert-warning").slideUp();
});
